﻿<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" autoFlush="true"%>
<%@ taglib uri="/WEB-INF/displaytag.tld" prefix="display"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="/WEB-INF/qautil.tld" prefix="qautil"%>
<%request.setAttribute("curDate",new java.util.Date());%>
<div><span class="title2">帖子搜索&nbsp;</span></div>
    <display:table name="questions" class="qlist" id="question" cellpadding="0" cellspacing="0">
        <display:column title="分类">
            <c:set var="qcatId" value="${question.mrIaskCategory.id}"/>
            <html:link page="/question.mrqa?action=list" paramId="catId" paramName="qcatId">
                [<c:out value="${question.mrIaskCategory.name}"/>]
            </html:link>
        </display:column>
        <display:column title="标题">
            <html:link page="/question.mrqa?action=view" paramId="id" paramName="question" paramProperty="id">
            	<c:if test="${question.titleAttribute != null}">
            		<span style="<c:out value="${question.titleAttribute}" />">
            	</c:if>
                <c:out value="${question.title}" escapeXml="false"/> <c:if test="${question.isExpired == true}">(已过期)</c:if>
              <c:if test="${question.titleAttribute != null}">
            		</span>
            	</c:if>
            </html:link>
            <c:set var="differ" value="${(curDate.time-question.postDate.time)/3600000}"/>
            <c:if test="${differ <= 48}">
                <font color="#FF0000" title="48小时内新帖子">(new)</font>
            </c:if>
            <c:if test="${question.state == '2' or question.state == '5'}">
                <font color="#FF0000" title="加急帖子">(急)</font>
            </c:if>
            <c:if test="${question.isSecondaryTop == true}">
                <font color="#FF0000" title="被置顶">(置顶)</font>
            </c:if>
            <c:if test="${question.fileName != null and question.fileName != ''}">
                <img src="qa/images/icon/attachment.gif" alt="有附件"/>
            </c:if>
    <%
        request.setAttribute("answersSizeInViewQuestionPage",com.mr.qa.GlobalConfigs.NUMBER_ANSWER_FOR_VIEW_QUESTION);
    %>
                <c:set var="answerSize" value="${fn:length(question.mrIaskAnswers)}"/>
            <c:if test="${answerSize > answersSizeInViewQuestionPage}">
                <c:set var="getFloatDivNumber" value="${answerSize / answersSizeInViewQuestionPage}"/>
                <fmt:formatNumber type="number" var="getRoundedDivNumber" value="${answerSize/answersSizeInViewQuestionPage}" maxFractionDigits="0"/>
                <c:set var="getModNumber" value="${answerSize % answersSizeInViewQuestionPage}"/>
                <fmt:formatNumber type="number" var="getRoundedDivNumber" value="${answerSize/answersSizeInViewQuestionPage}" maxFractionDigits="0"/>
                <c:set var="getDivNumber" value="${((getRoundedDivNumber-getFloatDivNumber)<=0.5 and (getRoundedDivNumber-getFloatDivNumber) > 0)?(getRoundedDivNumber-1):getRoundedDivNumber}"/>
                    <font color="black">[</font>
                    <fmt:formatNumber type="number" var="lastPageNo" value="${getModNumber==0?getDivNumber:(getDivNumber+1)}" maxFractionDigits="0"/>
                    <c:url var="lastPageLink" value="/question.mrqa?action=view&gotoLastPage=true">
                        <c:param name="page" value="${lastPageNo}"/>
                        <c:param name="id" value="${question.id}"/>
                    </c:url><a href="<c:out value="${lastPageLink}"/>"><c:out value="${lastPageNo}"/></a>
                    <font color="black">]</font>
                </c:if>
        </display:column>
        <display:column title="作者" style="width:90;">
                    <c:set var="user_id" value="${question.mrIaskUser.id}"/>
                    <html:link page="/user.mrqa?action=viewuserbyother" styleId="author" paramId="id" paramName="user_id">
                       <c:out value="${question.mrIaskUser.loginName}"/>
                    </html:link><br>
                    <fmt:formatDate value="${question.postDate}" type="both" pattern="yyyy-MM-dd"/>
        </display:column>
        <display:column title="人气">
            <c:out value="${question.viewCount}"/>/<c:out value="${answerSize}"/>
        </display:column>
        <display:column title="最后更新" style="width:90;">
                <c:if test="${answerSize > 0}">
                    <c:forEach var="answer" items="${question.mrIaskAnswers}" begin="${answerSize-1}">
                        <c:if test="${answer.mrIaskUser != null and not answer.isAnonymous}">
                            <c:url value="/user.mrqa?action=viewuserbyother" var="userlik">
                                <c:param name="id" value="${answer.mrIaskUser.id}"/>
                            </c:url>
                            <a href="<c:out value="${userlik}"/>"><c:out value="${answer.mrIaskUser.loginName}"/></a>
                        </c:if>
                        <c:if test="${answer.mrIaskUser == null or answer.isAnonymous}">
                            <c:out value="${answer.anonymousUser}"/>
                        </c:if>
                    </c:forEach>
                </c:if>
                <c:if test="${answerSize == 0}">
                    <html:link page="/user.mrqa?action=viewuserbyother" styleId="author" paramId="id" paramName="user_id">
                        <c:out value="${question.mrIaskUser.loginName}"/>
                    </html:link>
                </c:if><br>
                <fmt:formatDate value="${question.changeDate}" type="both" pattern="yyyy-MM-dd HH:mm"/>
        </display:column>
    </display:table>
<qautil:page action="/question.mrqa"/>
<c:if test="${questionsSize < questionsSizePerPage}">
<br>
<br>
<div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-3370373040606812";
/* MR_Iask_List 468x60, by William 08-8-30 */
google_ad_slot = "8374166115";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</c:if>